﻿using RuoVea.ExDto;
using RuoVea.ExEnum;
using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApi.Log.Entitys;

/// <summary>
/// 访问日志表
/// </summary>
[SugarTable(nameof(SysLogVis), "访问日志表")]
[Description("访问日志表")]
[Tenant("0")]
public class SysLogVis : AutoKeyBase, ITenantEntity
{
    /// <summary>
    /// 租户Id
    /// </summary>
    [ConfigSugarTenantColumn("TenantId", "租户Id", false, true, false)]
    public long? TenantId { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Name), columnDescription:"名称", IsNullable = true)]
    public string Name { get; set; }

    /// <summary>
    /// 是否执行成功（Y-是，N-否）
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Success), columnDescription:"是否执行成功")]
    public YesOrNot Success { get; set; }

    /// <summary>
    /// 具体消息
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Message), columnDescription:"具体消息", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string Message { get; set; }

    /// <summary>
    /// IP
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Ip), columnDescription:"IP", IsNullable = true)]
    public string Ip { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Location), columnDescription:"地址", IsNullable = true)]
    public string Location { get; set; }

    /// <summary>
    /// 浏览器
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Browser), columnDescription:"浏览器", IsNullable = true)]
    public string Browser { get; set; }

    /// <summary>
    /// 操作系统
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Os), columnDescription:"操作系统", IsNullable = true)]
    public string Os { get; set; }

    /// <summary>
    /// 访问类型
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(VisType), columnDescription:"访问类型")]
    public LoginType VisType { get; set; }

    /// <summary>
    /// 访问时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(VisTime), columnDescription:"访问时间")]
    public DateTime VisTime { get; set; }

    /// <summary>
    /// 访问人
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Account), columnDescription:"访问人", IsNullable = true)]
    public string Account { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(CreateTime), columnDescription:"创建时间", IsOnlyIgnoreUpdate = true)]
    public virtual DateTime? CreateTime { get; set; }
}
